package com.alpaca.recommend.bean;

import com.alpaca.recommend.hbase.activerecord.HModel;

/**
 * Items实体值.
 */
public class Item extends HModel<Item> {

    public static final Item dao = new Item();


    /**
     * item组.
     */
    public static final String ITEMS_I_FAMILY = "i";

    /**
     * tag:标签.
     */
    public static final String ITEMS_I_TAG = "t";

    /**
     * content:内容.
     */
    public static final String ITEMS_I_CONTENT = "c";

    /**
     * channelcode:频道号
     */
    public static final String ITEMS_I_CHANNEL_CODE = "cc";


    /**
     * 初始化构造函数.
     */
    public void init(String itemId, String[] tag, String content, String channelcode) {
        //设置rowkey.
        setRow(itemId);
        //设置tag.
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < tag.length; i++) {
            sb.append(tag[i] + ",");
        }
        String value = sb.substring(0, sb.length() - 1);

        set(ITEMS_I_FAMILY, ITEMS_I_TAG, value);
        //设置内容.
        set(ITEMS_I_FAMILY, ITEMS_I_CONTENT, content);
        //设置频道号.
        set(ITEMS_I_FAMILY, ITEMS_I_CHANNEL_CODE, channelcode);
    }

}
